﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Shop.Core.Domain.Common
{
    [Serializable]
    public class Lenght
    {
        public Lenght(decimal value = 0, LenghtUnit unit = LenghtUnit.CM, int precision = 2, bool isAutoRounding = true)
        {
            this.Value = value;
            this.Unit = unit;
            this.Precision = precision;
            this.IsAutoRounding = isAutoRounding;
        }
        public LenghtUnit Unit
        {
            get;
            protected set;
        }

        public decimal Value
        {
            get;
            protected set;
        }
        /// <summary>
        /// 获取精度设置
        /// </summary>
        public int Precision
        {
            get;
            protected set;
        }
        /// <summary>
        /// 获取是否自动Round
        /// </summary>
        public bool IsAutoRounding
        {
            get;
            protected set;
        }
    }

    public enum LenghtUnit
    {
        /// <summary>
        /// 毫米
        /// </summary>
        MM = 0,
        /// <summary>
        /// 厘米
        /// </summary>
        CM = 1,
        /// <summary>
        /// 米
        /// </summary>
        M = 2,
        /// <summary>
        /// 千米
        /// </summary>
        KM = 3,
        /// <summary>
        /// 英寸
        /// </summary>
        Inch = 4,
    }
}
